Skip to content

Add schema default/fixed value support in DOM#325

Merged
php-pulls merged 1 commit into
php:PHP-5.5from
DaveRandom:PHP-5.5
Aug 11, 2013
Merged

Add schema default/fixed value support in DOM#325
php-pulls merged 1 commit into
php:PHP-5.5from
DaveRandom:PHP-5.5

Conversation

@DaveRandom

Copy link
Copy Markdown
Contributor

Added support for adding fixed/default values during XSD validation in the DOM extension.

This patch adds a second (optional) $flags argument to DOMDocument::schemaValidate() and DOMDocument::schemaValidateSource(), which is a bitmask of libxml schema validation context options. It also defines an additional PHP constant, LIBXML_SCHEMA_CREATE, corresponding to libxml's XML_SCHEMA_VAL_VC_I_CREATE, which is currently the only valid flag that can be passed. When passed, the schema validation procedure will add default values from the schema when they are unspecified in the document.

The default value for the optional $flags parameter is 0, which results in the current behaviour - hence merging this feature does not cause a BC-break.

See http://stackoverflow.com/q/15948847/889949 for more information.

@hakre

hakre commented Apr 12, 2013

Copy link
Copy Markdown
Contributor

This is pretty nice. I hope I get the time at the weekend to compile PHP 5.5 and test this. I'd say you can squash the four commits into one to polish this a bit.

Added support for adding fixed/default values during XSD validation
and added/updated associated tests
@DaveRandom

Copy link
Copy Markdown
Contributor Author

@hakre Squashed for your compiling pleasure. Also note that this should backport nicely to 5.4 and even 5.3 if you really want. The only stipulation is that you compile against libxml >=2.6.14.

@php-pulls php-pulls merged commit c091819 into php:PHP-5.5 Aug 11, 2013
andypost added a commit to skilld-labs/php-src that referenced this pull request Jul 16, 2026
The Boost.Context 1.91.0 sync (phpGH-22584) pulled in boostorg/context#325,
"fix cortex-m0 support to aapcs_elf_gas target", which adds a fallback
branch to make_fcontext/jump_fcontext for the Thumb-1 encoding limits of
ARMv6-M. The branch is correct for Cortex-M0 but is gated on
__ARM_ARCH >= 7, which is also false for classic ARMv6 in ARM state
(Alpine armhf, Raspberry Pi 1/Zero) -- targets that can encode every
instruction in the >= 7 branch and need none of the workaround.

Two consequences. make_fcontext took `ldr a2, =finish', materialising the
absolute address of finish through a literal pool in .text and emitting
R_ARM_ABS32 against .text. In a PIE link that becomes an R_ARM_RELATIVE
dynamic relocation inside the read-only text segment, tagging the binary
DT_TEXTREL. musl supports DT_TEXTREL only for DSOs it maps itself; the
main executable is kernel-mapped and handled by kernel_mapped_dso(),
which never inspects it, so ldso writes to a read-only page and dies with
SIGSEGV in do_relocs() before main(). Every SAPI, every invocation, no
output. glibc masks this by mprotecting the segment writable, which is
why only musl builds noticed.

Separately, jump_fcontext -- the hot path on every fiber switch -- grew
from 13 to 43 instructions on all ARMv6 builds, glibc included.

Gate on __ARM_ARCH_6M__ instead, exactly the target php#325 names. The
result emits byte-identical .text to 8.6.0alpha1 on every ARM target
except Cortex-M0, where it emits byte-identical .text to current master:
each target gets back the code it had before the regression, and M0 keeps
what php#325 added. armv7 and arm64 are unaffected either way.

Zend/asm is vendored and verified by the Verify Bundled Files workflow,
so carry the same diff in .github/scripts/download-bundled and re-apply
it from the sync script, as uriparser already does.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants